﻿@model UserMoveViewModel
	<form class="layui-form" asp-controller="User" asp-action="UserMove" method="post">
		<div class="layui-form-item">
			<label class="layui-form-label">从目标</label>
			<div class="layui-input-block">
				<span class="select-box inline">
					<select id="dropIdType" class="select" onchange="SelectIdType()" asp-for="@Model.IdType" lay-ignore>
						<option value="0">会员ID</option>
						<option value="1">会员名</option>
						<option value="2">会员组</option>
					</select>
				</span>
				<span id="ctlIds" style="display:none;">
					<span class="select-box inline" style="min-width:200px;">
						<input type="text" class="layui-input" asp-for="@Model.ids" data-val="true" data-val-required="不能为空" placeholder="多个ID间请用“,”分隔">
					</span>
					<span style="color:red;" class="field-validation-valid" data-valmsg-for="ids" data-valmsg-replace="true"></span>
				</span>
				<span id="ctlUserName" style="display:none;">
					<span class="select-box inline" style="min-width:200px;">
						<input type="text" class="layui-input" asp-for="@Model.UserName" data-val="true" data-val-required="不能为空" placeholder="多个会员名间请用“,”分隔">
					</span>
					<span style="color:red;" class="field-validation-valid" data-valmsg-for="UserName" data-valmsg-replace="true"></span>
				</span>
				<span id="ctlGroupIDs" style="display:none;">
					<span class="select-box inline" style="min-width:200px;">
						<select asp-for="@Model.GroupIDs" data-val="true" data-val-required="不能为空" id="dropGroupIDs" class="select" style="padding:0px;width:100%;" lay-ignore></select>
					</span>
					<span style="color:red;" class="field-validation-valid" data-valmsg-for="GroupIDs" data-valmsg-replace="true"></span>
				</span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">移动到</label>
			<div class="layui-input-block">
				<select asp-for="@Model.RightGroupID" id="RightGroupID" class="layui-input" style="padding:0px;" lay-ignore></select>
				<span asp-validation-for="@Model.RightGroupID" style="color:red;"></span>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="submit" class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="btnSubmit">提交</button>
				<button type="button" class="layui-btn layuiadmin-btn-list" onclick="layer_close()">取消</button>
			</div>
		</div>
		@Html.AntiForgeryToken()
	</form>
@section scripts{
	<script type="text/javascript">
		function SelectIdType() {
			var IdType = $("#dropIdType").val();
			if (IdType == "0") {
				$("#ctlIds").show();
				$("#ctlUserName").hide();
				$("#ctlGroupIDs").hide();
				$("#ids").attr("disabled", false);
				$("#UserName").attr("disabled", true);
				$("#dropGroupIDs").attr("disabled", true);
			}
			else if (IdType == "1") {
				$("#ctlIds").hide();
				$("#ctlUserName").show();
				$("#ctlGroupIDs").hide();
				$("#ids").attr("disabled", true);
				$("#UserName").attr("disabled", false);
				$("#dropGroupIDs").attr("disabled", true);
			}
			else if (IdType == "2") {
				$("#ctlIds").hide();
				$("#ctlUserName").hide();
				$("#ctlGroupIDs").show();
				$("#ids").attr("disabled", true);
				$("#UserName").attr("disabled", true);
				$("#dropGroupIDs").attr("disabled", false);
			}
		}
		$(function () {
			loadUserGroupsAjax("dropGroupIDs", "@Model.GroupIDs", true);
			loadUserGroupsAjax("RightGroupID", "@Model.RightGroupID", false);
			SelectIdType();
		});
	</script>
}